]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
telepathyClient: Keep source alive while channel is open
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 10 Apr 2015 11:19:23 +0000 (13:19 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 11 Apr 2015 20:53:42 +0000 (22:53 +0200)
Sources are destroyed with their last notification. This is usually the
correct behavior, however in case of chat sources, the corresponding
telepathy channel might still be open, and any further messages that
should trigger a notification are lost because chat sources are only
created when telepathy's channel dispatcher notifies us about a channel
(via ObserveChannels).
Loosing messages like this is unexpected, so keep chat sources around
even without notifications while the channel is open.

https://bugzilla.gnome.org/show_bug.cgi?id=747636

js/ui/components/telepathyClient.js

index 061b813b40e93f4bb80b9b4f3e93e63b25aa452d..3aa06e7b875fa7958a0ed1fa4257507eee91ce62 100644 (file)
@@ -158,14 +158,6 @@ const TelepathyClient = new Lang.Class({
         this._chatSources[channel.get_object_path()] = source;
         source.connect('destroy', Lang.bind(this,
                        function() {
-                           if (this._tpClient.is_handling_channel(channel)) {
-                               // The chat box has been destroyed so it can't
-                               // handle the channel any more.
-                               channel.close_async(function(src, result) {
-                                   channel.close_finish(result);
-                               });
-                           }
-
                            delete this._chatSources[channel.get_object_path()];
                        }));
     },
@@ -474,6 +466,18 @@ const ChatSource = new Lang.Class({
     },
 
     destroy: function(reason) {
+        if (this._client.is_handling_channel(this._channel)) {
+            // The chat box has been destroyed so it can't
+            // handle the channel any more.
+            this._channel.close_async(function(channel, result) {
+                channel.close_finish(result);
+            });
+        }
+
+        // Keep source alive while the channel is open
+        if (reason != MessageTray.NotificationDestroyedReason.SOURCE_CLOSED)
+            return;
+
         if (this._destroyed)
             return;